﻿<?php
define('Copyright', '作者QQ:2280005200');
define('ROOT_PATH', $_SERVER["DOCUMENT_ROOT"].'/');
include_once ROOT_PATH.'function/global.php';

$ConfigModel = configModel("
`g_out_time`,
`g_automatic_open_number_lock`,
`g_automatic_open_result_lock`,
`g_up_odds_mix`,
`g_odds_execution_lock`,
`g_odds_num`,
`g_odds_str`,
`g_up_odds_mix_cq`,
`g_odds_num_cq`,
`g_odds_str_cq`,
`g_odds_num_gx`,
`g_odds_str_gx`,
`g_automatic_money_lock`,
`g_insert_number_day`,
`g_close_time`,
`g_up_odds_mix_pk`,
`g_odds_num_pk`,
`g_odds_str_pk`,
`g_up_odds_mix_nc`,
`g_odds_num_nc`,
`g_odds_str_nc`,
`g_up_odds_mix_xj`,
`g_odds_num_xj`,
`g_odds_str_xj`,
`g_restore_money_lock`");  


 
//快乐十分

######################################################################

$a = file_get_contents("http://t.apiplus.net/gdklsf-1.json"); 
$data = json_decode($a,true);
$datas = $data['data'][0];

$url = 'http://ssc.szsscp.top/jieshui.php';
$post_data['bclass_wd']       = 'gdkl10f';
$post_data['enddt']      = $datas['opentime'];
$post_data['expect'] = $datas['expect'];
$post_data['opencode']    = $datas['opencode'];
$result = $db->query("SELECT `g_qishu`,  `g_open_date` FROM `g_kaipan` WHERE `g_lock` = 2 or `g_lock` = 3 ORDER BY g_qishu desc LIMIT 1 ", 1);

$a = mb_substr($result[0]['g_qishu'], -2);
$b = mb_substr($result[0]['g_qishu'],0,8);
$openTerm = $b.'0'.$a;
file_put_contents('D:\www\DB\3.txt',222);die;
if($openTerm <= $post_data['expect']){
	$res = request_post($url, $post_data);
} 
    
       

######################################################################	 

function request_post($url = '', $post_data = array()) {
        if (empty($url) || empty($post_data)) {
            return false;
        }
       
        $o = "";
        foreach ( $post_data as $k => $v ) 
        { 
            $o.= "$k=" . urlencode( $v ). "&" ;
        }
        $post_data = substr($o,0,-1);
        $postUrl = $url;
        $curlPost = $post_data;
        $ch = curl_init();//初始化curl
        curl_setopt($ch, CURLOPT_URL,$postUrl);//抓取指定网页
        curl_setopt($ch, CURLOPT_HEADER, 0);//设置header
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
        curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
        curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
        $data = curl_exec($ch);//运行curl
        curl_close($ch);
        //return $data;
    }
	
	
 die;
//北京赛车PK10

######################################################################

/* $a_pk = file_get_contents("http://t.apiplus.net/cqssc-1.json"); 
$datas_pk = json_decode($a_pk,true);
$data_pk = $datas_pk['data'][0];

$url_pk = 'http://111.67.192.168/jieshui.php';
$post_data_pk['bclass_wd']       = 'pk10';
$post_data_pk['enddt']      = $data_pk['opentime'];
$post_data_pk['expect'] = $data_pk['expect'];
$post_data_pk['opencode']    = $data_pk['opencode'];
$result_pk = $db->query("SELECT `g_qishu`,  `g_open_date` FROM `g_kaipan2` WHERE `g_lock` = 2 or `g_lock` = 3 ORDER BY g_qishu desc LIMIT 1 ", 1);

if($result_pk[0]['g_qishu']<=$post_data_pk['expect']){
	$res_pk = request_post_pk($url_pk, $post_data_pk);
} */
######################################################################	


?>